#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

void solve(){
    ll p;
    cin>>p;
    if(p==0){
    	cout<<"YES"<<'\n';
    	return;
    }
    if(p==1){
    	cout<<"NO"<<'\n';
    	return;
    }
    vector<int> a;
    int cnt=0,l=0x3f3f3f3f,r=-1;
    a.push_back(0);
    while(p){
    	if(p&1){
    		a.push_back(1);
    		cnt++;
    	}
    	else a.push_back(0);
    	p>>=1;
    }
    if(cnt&1){
    	cout<<"NO"<<'\n';
    	return;
    }
    int n=a.size();
    for(int i=1;i<n;i++){
    	if(a[i]){
	    	l=min(i,l);
	    	r=max(i,r);
	    }
    }
    while(l<r){
    	if(a[l]!=a[r]){
    		cout<<"NO"<<'\n';
    		return;
    	}
    	l++,r--;
    }
    cout<<"YES"<<'\n';
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    int t=1;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}